package app.view.component.loading 
{
	import com.greensock.TweenLite;
	import flash.display.MovieClip;
	
	/**
	 * ...
	 * @author hungconcon
	 */
	public class ProgessBezier
	{
		private var move:MovieClip;
		private var left:MovieClip;
		private var center:MovieClip;
		private var right:MovieClip;
		private var xleft:Number;
		private var xright:Number;
		private var capwidth:Number;
		private var firstSize:Number;
		private var currentWidth:Number;
		private var barwidth:Number;
		private var percent:Number = 0;
		private var istween:Boolean = false;
		public function ProgessBezier(value:MovieClip, xleft:Number, xright:Number, capwidth:Number, tween:Boolean = false) {
			this.istween 	= tween;
			this.move 		= value;
			this.left 		= move.left;
			this.center 	= move.center;
			this.right 		= move.right;
			this.xleft 		= xleft;
			this.xright 	= xright;
			this.capwidth 	= capwidth;
		}
		public function set limited(value:Number):void {
			//firstSize = value;
			firstSize = value;
		}
		/**
		 * 0.01
		 * 0.03
		 * 0.06
		 * @param value <=> percent
		 */
		public function set repercent(value:Number):void {
			percent	= value;
			onsize  = percent * firstSize;
		}
		public function set percentage(value:Number):void {
			percent = value / firstSize;
			onsize  = value;
		}
		public function set resize(value:Number):void {
			limited = value;
			onsize = (percent * value);
		}
		public function set resizeSpect(value:Number):void {
			limited = value;
			onsizeuntween = (percent * value);
		}
		public function set onsizeuntween(value:Number):void {
			currentWidth = value;			
			left.x = 0;								   
			center.width = value;
			right.x 	 = left.width + value;
		}
		public function set onsize(value:Number):void {
			currentWidth = value;
			left.x = 0;					   
			if (istween) {
				if (value == 0) {
					center.width = value;
					right.x 	 = left.width + value;
				}else {
					TweenLite.to(center, 0.5, { width:value } );
					TweenLite.to(right, 0.5, { x:(left.width + value) } );
				}
			}else {
				center.width = value;
				right.x 	 = left.width + value;
			}

		}
		public function get width():Number {
			return xleft + left.width + currentWidth;
		}
		public function set setVisible(value:Boolean):void {
			this.move.visible = value;
		}
	}

}